home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 003-desktop.lzm / usr / bin / kdeactivate < prev    next >
Encoding:
Text File  |  2008-02-09  |  1.1 KB  |  38 lines

  1. #!/bin/bash
  2.  
  3. FILE="$1"
  4. BASE=$(basename "$FILE" .lzm).lzm
  5. HTTP=/mnt/live/memory/httpfs
  6.  
  7. # show info message and remember PID of the process (we'll need to kill the message later on)
  8. kdialog --passivepopup "$BASE: module deactivation in progress, wait please..." 10000 & KILLPID=$!
  9.  
  10. # remove the module from the live filesystem
  11. deactivate -k "$FILE"
  12. err=$?
  13.  
  14. if [ $err -eq 1 ]; then
  15.    kill $KILLPID
  16.    kdialog --icon error --title "deactivate error" --error "Module is not activated"
  17.    exit 4
  18. fi
  19.  
  20. if [ $err -ne 0 ]; then
  21.    kill $KILLPID
  22.    kdialog --icon error --title "deactivate error" --error "Module can't be deactivated. Perhaps some files from the module are still used, opened or executed."
  23.    exit 3
  24. else
  25.    # if http/slik module was mounted, clean up
  26.    if [ -d "$HTTP/$BASE" ]; then
  27.       umount "$HTTP/$BASE"
  28.       rm -f "$HTTP/$BASE/slik.url"
  29.       rmdir "$HTTP/$BASE"
  30.    fi
  31.    # Rebuild the system configuration cache for KDE (mainly to update KDE menu)
  32.    kbuildsycoca 2>/dev/null
  33.    kill $KILLPID
  34.    kdialog --passivepopup "Well done! $BASE: module deactivated." 5 &
  35. fi
  36.  
  37. exit 0
  38.